<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Slideshow;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        //轮播图
        $slideModel = new Slideshow();
        $slideList = $slideModel->where(['status' => '1'])->order('weigh', 'desc')->select();

        //产品信息
        $where = ['hot_switch' => 1, 'status' => 1, 'is_free' => 0];
        $field = "id,title,category_id,image,min_price,progress";
        $productList = \app\common\model\Product::getList($where,$field, 'id desc', 6);

        $this->success('请求成功',[
            'slideList' => $slideList,
           'productList' => $productList
        ]);
    }
}
